* {
    box-sizing: border-box;
    // 高亮取消
    outline: none;
    // border: 0;
}

html {
    font-size: 13px;
}

body {
    margin: 0;
    padding: 0;
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.2em;
    background: #f1f1f1;
    // 字体变细
    -webkit-font-smoothing: antialiased;
}

a {
    color: #999;
    text-decoration: none;
}

p {
    line-height: 1.5em;
}

// colors
$colors: (
    'primary':#db9e3f,
    'white': #fff,
    'info': #4b67af,
    'blue':#4394e4,
    'danger':#791a15,
    'blue-1':#1f3695,
    'light': #f9f9f9,
    'light-1': #d4d9de,
    'black': #000,
    'dark':#222,
    'dark-1':#343440,
    'grey':#999,
    'grey-1':#666,
);

$border-color: #d4d9de;

@each $colorKey,
$color in $colors {
    .text-#{$colorKey} {
        color: $color;
    }

    .bg-#{$colorKey} {
        background-color: $color;
    }
}

// text-align @each
@each $var in (left, center, right) {
    .text-#{$var} {
        text-align: $var;
    }
}

$base-font-size: 1rem;
$font-sizes: (
    xss:0.6154,
    //8px
    xs: 0.7692,
    //10px
    sm:0.9231,
    //12px
    md:1,
    //13px
    lg:1.0769,
    //14px
    xl:1.2308 //16px
);

@each $sizeKey,
$size in $font-sizes {
    .fs-#{$sizeKey} {
        font-size: $size * $base-font-size;
    }
}

.text-ellipsis {
    display: inline-block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

// flex 
.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

$flex-jc: (
    start:flex-start,
    end:flex-end,
    center:center,
    between:space-between,
    around:space-around
);

@each $key,
$val in $flex-jc {
    .jc-#{$key} {
        justify-content: $val;
    }
}

$flex-ai: (
    start:flex-start,
    end:flex-end,
    center:center,
    stretch:stretch
);

@each $key,
$val in $flex-ai {
    .ai-#{$key} {
        align-items: $val;
    }
}

.flex-1 {
    flex: 1;
}

.flex-grow-1 {
    flex-grow: 1;
}

// spacing
//0-5

$spacing-types: (
    m:margin,
    p:padding
);
$spacing-directions: (
    t:top,
    r:right,
    l:left,
    b:bottom
);
$spacing-base-size: 1rem;
$spacing-sizes: (
    0:0,
    1:0.25,
    2:0.5,
    3:1,
    4:1.5,
    5:3
);

@each $typeKey,
$type in $spacing-types {

    // .m-1
    @each $sizeKey,
    $size in $spacing-sizes {

        // .m-1{margin:1.25rem;}
        .#{$typeKey}-#{$sizeKey} {
            #{$type}: $size*$spacing-base-size;
        }
    }

    // .mx-1 .my-1
    @each $sizeKey,
    $size in $spacing-sizes {

        // .mx-1{margin-left/right:1.25rem;}
        .#{$typeKey}x-#{$sizeKey} {
            #{$type}-left: $size*$spacing-base-size;
            #{$type}-right: $size*$spacing-base-size;
        }

        // .my-1{margin-top/bottom:1.25rem;}
        .#{$typeKey}y-#{$sizeKey} {
            #{$type}-top: $size*$spacing-base-size;
            #{$type}-bottom: $size*$spacing-base-size;
        }
    }

    @each $directionKey,
    $direction in $spacing-directions {

        @each $sizeKey,
        $size in $spacing-sizes {

            // .mt-1{margin-top:1.25rem;}
            .#{$typeKey}#{$directionKey}-#{$sizeKey} {
                #{$type}-#{$direction}: $size*$spacing-base-size;
            }
        }
    }
}

// button
.btn {
    border: none;
    border-radius: 0.1538rem;
    // 从上面获取定义的属性值
    font-size: map-get($font-sizes, 'sm') * $base-font-size;
    padding: 0.2rem 0.6rem;
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

// nav
.nav {
    display: flex;

    .nav-item {
        border-bottom: 3px solid transparent;
        padding: 0.2rem;

        &.active {
            color: map-get($colors, 'primary');
            border-bottom-color: map-get($colors, 'primary');

        }
    }

    &.nav-inverse {
        .nav-item {
            color: map-get($colors, 'white');

            &.active {
                color: map-get($colors, 'primary');
                border-bottom-color: map-get($colors, 'white');

            }
        }
    }
}

.sprite {
    background: url(../img/index.png) no-repeat 0 0;
    background-size: 28.8462rem;
    display: inline-block;

    &.sprite-news {
        width: 1.7692rem;
        height: 1.5385rem;
        background-position: 63.546% 15.517%;
    }

    &.sprite-arrow {
        width: 0.7692rem;
        height: 0.7692rem;
        background-position: 38.577% 52.076%;
    }
}

// borders
@each $dir in (top, left, right, bottom) {
    .border-#{$dir} {
        border-#{$dir}: 1px solid $border-color;
    }
}